package com.oocl.training.util;

import java.util.Set;

import com.oocl.training.parser.impl.XmlParser;
import com.oocl.training.pojo.Customer;

public class PrintUtil {

	/**
	 * 简单格式输出
	 * @param customers
	 * @return
	 */
	public static void simplePrint(Set<Customer> customers){
		StringBuilder sb = new StringBuilder();
		sb.append("ID \tName \t\t Email \t\t       Sex \t birthday \t\n");
		for(Customer c : customers){
			sb.append(c.getId() +"\t"+c.getName()+"\t\t"+c.getEmail()+"\t\t"+c.getSex()+"\t"+c.getBirthday()+"\n");
		}
		System.out.println(sb.toString());
	}
	
	/**
	 * XML格式输出
	 * @param customers
	 * @return
	 */
	public static void xmlPrint(Set<Customer> customers){
		XmlParser xmlParser = new XmlParser();
		System.out.println(xmlParser.parse(customers));
	}
}
